home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / var / lib / dpkg / info / openoffice.org-core.postrm < prev    next >
Encoding:
Text File  |  2009-04-14  |  2.9 KB  |  106 lines

  1. #!/bin/sh
  2.  
  3. # postrm script for openoffice.org-core
  4.  
  5. THIS_PACKAGE=openoffice.org-core
  6. THIS_SCRIPT=postrm
  7.  
  8. set -e
  9.  
  10. LIBSUFFIX=li
  11. PLATFORMID=linux_x86
  12.  
  13. # vim:set ai et sts=2 sw=2 tw=0:
  14.  
  15. # Query the terminal to establish a default number of columns to use for
  16. # displaying messages to the user.  This is used only as a fallback in the
  17. # event the COLUMNS variable is not set.  ($COLUMNS can react to SIGWINCH while
  18. # the script is running, and this cannot, only being calculated once.)
  19. DEFCOLUMNS=$(stty size 2> /dev/null | awk '{print $2}') || true
  20. if ! expr "$DEFCOLUMNS" : "[[:digit:]]\+$" > /dev/null 2>&1; then
  21.   DEFCOLUMNS=80
  22. fi
  23.  
  24. message() {
  25.     echo "$*" | fmt -t -w ${COLUMNS:-$DEFCOLUMNS} >&2
  26. }
  27.  
  28. # Prepare to move a conffile without triggering a dpkg question
  29. prep_rm_conffile() {
  30.     CONFFILE="$1"
  31.  
  32.     if [ -e "$CONFFILE" ]; then
  33.         md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  34.         old_md5sum="`dpkg-query -W -f='${Conffiles}' $2 | grep $CONFFILE | awk '{print $2}'`"
  35.         if [ "$md5sum" = "$old_md5sum" ]; then
  36.             mv "$CONFFILE" "$CONFFILE.${THIS_PACKAGE}-tmp"
  37.         fi
  38.     fi
  39. }
  40.  
  41. rm_conffile_commit() {
  42.   CONFFILE="$1"
  43.  
  44.   if [ -e $CONFFILE.${THIS_PACKAGE}-tmp ]; then
  45.     rm $CONFFILE.${THIS_PACKAGE}-tmp
  46.   fi
  47. }
  48.  
  49. # Remove a no-longer used conffile
  50. rm_conffile() {
  51.     CONFFILE="$1"
  52.  
  53.     if [ -e "$CONFFILE" ]; then
  54.         md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  55.         old_md5sum="`dpkg-query -W -f='${Conffiles}' $2 | grep $CONFFILE | awk '{print $2}'`"
  56.         if [ "$md5sum" != "$old_md5sum" ]; then
  57.             echo "Obsolete conffile $CONFFILE has been modified by you."
  58.             echo "Saving as $CONFFILE.dpkg-bak ..."
  59.             mv -f "$CONFFILE" "$CONFFILE".bak
  60.         else
  61.             echo "Removing obsolete conffile $CONFFILE ..."
  62.             rm -f "$CONFFILE"
  63.         fi
  64.     fi
  65. }
  66.  
  67. flush_unopkg_cache() {
  68.     /usr/lib/openoffice/program/unopkg list --shared > /dev/null 2>&1
  69. }
  70.  
  71. remove_extension() {
  72.   if /usr/lib/openoffice/program/unopkg list --shared $1 >/dev/null; then
  73.     echo -n "Removing extension $1..."
  74.     INSTDIR=`mktemp -d`
  75.     /usr/lib/openoffice/program/unopkg remove --shared $1 \
  76.       "-env:UserInstallation=file://$INSTDIR" \
  77.       '-env:UNO_JAVA_JFW_INSTALL_DATA=$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml' \
  78.       "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1"
  79.     if [ -n $INSTDIR ]; then rm -rf $INSTDIR; fi
  80.     echo " done."
  81.     flush_unopkg_cache
  82.   fi
  83. }
  84.  
  85. add_extension() {
  86.   echo -n "Adding extension $1..."
  87.   INSTDIR=`mktemp -d`
  88.   /usr/lib/openoffice/program/unopkg add --shared $1 \
  89.     "-env:UserInstallation=file:///$INSTDIR" \
  90.     '-env:UNO_JAVA_JFW_INSTALL_DATA=$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml' \
  91.     "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1"
  92.   if [ -n $INSTDIR ]; then rm -rf $INSTDIR; fi
  93.   echo " done."
  94. }
  95.  
  96. VER=
  97.  
  98.  
  99. if [ "$1" = "remove" ]; then
  100.     rm -rf /var/spool/openoffice$VER
  101. fi
  102.  
  103.  
  104.  
  105. exit 0
  106.